FROM golang:alpine as builder

MAINTAINER wu.liangxing@towngasvcc.com

ENV GOPROXY https://goproxy.cn/
ENV GO111MODULE on

WORKDIR /data/www

COPY . .
RUN go mod tidy
RUN go get

RUN CGO_ENABLED=0 GOOS=linux go build -o backend  -ldflags "-X main.buildDate=`date  +\"%Y-%m-%dT%H:%M:%S\"` -X main.buildVersion=1.0.0" -tags=prod -tags=prod -v

FROM alpine

COPY --from=builder /data/www /

CMD [ "/backend" ]

EXPOSE 20219

